 
//---------------------驼峰标识转换为下划线标识---------------------------------------------------------------------------------------


/** 
	 * @Title: humpConverUnderline 
	 * @Description: 驼峰标识字符串转换为下划线标识
	 * @param character
	 * @return
	 */
function   humpConverUnderline(character){
	if(typeof(character) == "string"){
		return character.replace(/[A-Z]/g,function(letter){return "_"+letter.toLowerCase()});
	}else{
		return "";
	};
	
}

/** 
 * @Title: humpMapConverUnderline 
 * @Description: 驼峰标识字符串Map转换为下划线标识
 * @param map        map  = {aBCD:1}
 * @return           {a_b_c_d:1}
 */
function   humpMapConverUnderline(map){
	if(typeof(map) == "object"){
		 var newMap = {};
	     for(var m in map){
	    	 newMap[humpConverUnderline(m)] = map[m];
	     }
	     return newMap;
	}else{
		return {};
	}  
};


/** 
 * @Title: humpArrayConverUnderline 
 * @Description: 把包含驼峰标识的Array中Map对象属性 下转换为 划线标的Array中Map对象属性
 * @param map        map  = {aBCD:1}
 * @return           {a_b_c_d:1}
 */
function   humpArrayConverUnderline(array){
	if(array instanceof Array){
		 var newArray = [];
	     for(var i = 0 ; i < array.length ;i++){
	    	 newArray.push(humpMapConverUnderline(array[i]));
	     }
	     return newArray;
	}else{
		return [];
	}
    
}




/** 
 * @Title: humpObjectConverUnderline 
 * @Description: 把包含驼峰标识对象 下转换为 划线标的对象
 * @param   参数  obj  类型  1. string ""  ; 2.  Map {}  ; 3 . Array [];
 * @return           
 */
function   humpObjectConverUnderline(obj){
	 if(typeof(obj) == "string"){
		 return humpConverUnderline(obj);
	 }else if(array instanceof Array){
		 return humpArrayConverUnderline(obj);
	 }else if(typeof(obj) == "object"){
		 return humpMapConverUnderline(obj);
	 }else{
		 throw new error("数据格式不正确");
	 }
	 return null;
    
}



//---------------------下划线标识转换为驼峰标识---------------------------------------------------------------------------------------

	/** 
	 * @Title: underlineConverHump 
	 * @Description: 下划线标识字符串转换为驼峰标识
	 * @param character   character = "a_b_c_d";
	 * @return       aBCD
	 */
 function  underlineConverHump(character){
	 
	 if(typeof(character) == "string"){
		     return  character.replace(/_[A-Za-z]/g, function(letter){ return  letter.substring(1,2).toUpperCase(); });
		}else{
			return "";
		};
 };
 
 
 /** 
	 * @Title: underlineMapConverHump 
	 * @Description: 把包含下划线标的Map对象属性转换为驼峰标识的Map对象属性 
	 * @param map     map = {"a_b_c_d":1}
	 * @return    {aBCD:1}
	 */
function underlineMapConverHump(map){
	if(typeof(map) == "object"){
		var newMap = {};
	    for(var m in map){
			newMap[underlineConverHump(m)] = map[m];
		}
		return newMap;
	}else{
		return {};
	}  
};



/** 
 * @Title: underlineArrayConverHump 
 * @Description: 把包含下划线标的Array中Map对象属性转换为驼峰标识的Array中Map对象属性
 * @param name    array = [{"a_b_c_d":1},{"z_k_m_n":2}];
 * @return  [{"aBCD":1},{"zKMN":2}];
 */
function underlineArrayConverHump(array){
    if(array instanceof Array){
    	  var newArray = [];
    	  for(var i = 0 ; i < array.length ; i++){
    				newArray.push(underlineMapConverHump(array[i]));
    			}
    	  return newArray;
	}else{
		return [];
	}  
};




/** 
 * @Title: underlineObjectConverHump 
 * @Description: 把包含下划线标对象转换为驼峰标识对象象
 * @param      参数  obj  类型  1. string ""  ; 2.  Map {}  ; 3 . Array [];
 * @return   
 */
function underlineObjectConverHump(obj){
	 if(typeof(obj) == "string"){
		 return underlineConverHump(obj);
	 }else if(array instanceof Array){
		 return underlineArrayConverHump(obj);
	 }else if(typeof(obj) == "object"){
		 return underlineMapConverHump(obj);
	 }else{
		 throw new error("数据格式不正确");
	 }
	 return null;
};